﻿using Ingr.SP3D.Common.Client;

namespace NSGetData
{
    public class GraphicFormCommand : BaseGraphicCommand
    {
        private GraphicCmdLabFrom m_cmdFrom;
        private bool m_bStopInitiated;

        public static NSLoadDef NSDeadLoadDef
        {
            get { return m_NSDeadLoadDef; }
            set { m_NSDeadLoadDef = value; }
        }
        public static NSLoadDef NSLiveLoadDef
        {
            get { return m_NSLiveLoadDef; }
            set { m_NSLiveLoadDef = value; }
        }
        private static NSLoadDef m_NSDeadLoadDef;
        private static NSLoadDef m_NSLiveLoadDef;


        public override int EnableUIFlags
        {
            get { return (int)EnableUIFlagSettings.ActiveView; }
        }
        public override void OnStart(int commandID, object argument)
        {
            m_cmdFrom = new GraphicCmdLabFrom();
            m_NSDeadLoadDef = new NSLoadDef();
            m_NSDeadLoadDef.Name = "恒载";
            m_NSDeadLoadDef.LoadCase = LoadCaseDef.恒载;
            m_NSDeadLoadDef.GravityProxy = 1;

            m_NSDeadLoadDef.AdNonSeiCoefficient = 1.3;
            m_NSDeadLoadDef.BenNonSeiCoefficient = 1.0;

            m_NSDeadLoadDef.AdSeiCoefficient = 1.0;
            m_NSDeadLoadDef.BenSeiCoefficient = 1.0;

            m_NSDeadLoadDef.NonSesimicCoefficient = 1.0;
            m_NSDeadLoadDef.SesimicCoefficient = 1.0;
            m_NSDeadLoadDef.FreComCoefficient = 1.0;
            m_NSDeadLoadDef.QuasiPreComCoefficient = 1.0;

            m_NSDeadLoadDef.WallDisCoefficient = 1.0;
            m_NSDeadLoadDef.MainBeamDisCoefficient = 1.0;
            m_NSDeadLoadDef.SecBeamDisCoefficient = 1.0;

            m_NSLiveLoadDef = new NSLoadDef();
            m_NSLiveLoadDef.Name = "活载";
            m_NSLiveLoadDef.LoadCase = LoadCaseDef.活载;
            m_NSLiveLoadDef.GravityProxy = 0.5;

            m_NSLiveLoadDef.AdNonSeiCoefficient = 1.5;
            m_NSLiveLoadDef.BenNonSeiCoefficient = 1.5;

            m_NSLiveLoadDef.AdSeiCoefficient = 1.3;
            m_NSLiveLoadDef.BenSeiCoefficient = 1.0;

            m_NSLiveLoadDef.NonSesimicCoefficient = 0.7;
            m_NSLiveLoadDef.SesimicCoefficient = 0.5;
            m_NSLiveLoadDef.FreComCoefficient = 0.6;
            m_NSDeadLoadDef.QuasiPreComCoefficient = 0.5;


            m_NSLiveLoadDef.WallDisCoefficient = 1.0;
            m_NSLiveLoadDef.MainBeamDisCoefficient = 1.0;
            m_NSLiveLoadDef.SecBeamDisCoefficient = 1.0;

            m_cmdFrom.Show();
        }

        public override void OnStop()
        {
            if (m_bStopInitiated)
            {
                return;
            }

            m_bStopInitiated = true;
            m_cmdFrom.Close();
            m_cmdFrom = null;
            m_NSDeadLoadDef = null;
            m_NSLiveLoadDef = null;
        }

        public override void OnSuspend()
        {
            m_cmdFrom.Hide();
        }
        public override void OnResume()
        {
            if (m_cmdFrom != null)
            {
                m_cmdFrom.Show();
            }
        }
    }
}
